package top.lyjwn.todo.unique;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * uuid、GUID
 */
public class UIDUtil {

    public static String getTimeUUID() {
        String uuid36 = UUID.randomUUID().toString();
        SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyyMMddHHmmss");
        StringBuilder timeString = new StringBuilder(yyyyMMddHHmmss.format(new Date()));
        timeString.append(uuid36.replaceAll("-", ""));
        return timeString.toString();
    }

    public static String getTimeGUID() {
        String uuid36 = UUID.randomUUID().toString();
        SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyyMMddHHmmss");
        StringBuilder timeString = new StringBuilder(yyyyMMddHHmmss.format(new Date()));
        timeString.append(UUID.randomUUID());
        return timeString.toString();
    }

    public static String getUUID() {
        String uuid36 = UUID.randomUUID().toString();
        String uuid32 = uuid36.replaceAll("-", "");
        return uuid32;
    }


    public static String getGUID() {
        String uuid36 = UUID.randomUUID().toString();
        return uuid36;
    }

}
